package com.kingdee.eas.fi.gl.client;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;

import javax.swing.KeyStroke;

import org.apache.log4j.Logger;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.kdf.data.datasource.BOSQueryDataSource;
import com.kingdee.bos.ctrl.kdf.data.impl.ICrossPrintDataProvider;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTMergeManager;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent;
import com.kingdee.bos.ctrl.kdf.table.event.KDTSelectEvent;
import com.kingdee.bos.ctrl.kdf.util.style.Styles;
import com.kingdee.bos.ctrl.print.resource.Resources;
import com.kingdee.bos.ctrl.report.forapp.kdnote.client.KDNoteHelper;
import com.kingdee.bos.ctrl.swing.KDSeparator;
import com.kingdee.bos.ctrl.swing.StringUtils;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.MetaDataPK;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.basedata.assistant.CurrencyFactory;
import com.kingdee.eas.basedata.assistant.CurrencyInfo;
import com.kingdee.eas.basedata.framework.DataBaseDInfo;
import com.kingdee.eas.basedata.master.account.AccountViewInfo;
import com.kingdee.eas.basedata.master.auxacct.AsstAccountFactory;
import com.kingdee.eas.basedata.master.auxacct.AsstActTypeInfo;
import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.common.client.UIFactoryName;
import com.kingdee.eas.fi.gl.CollectEnum;
import com.kingdee.eas.fi.gl.GLGeneralFacadeFactory;
import com.kingdee.eas.fi.gl.GlUtils;
import com.kingdee.eas.fi.gl.IGLGeneralFacade;
import com.kingdee.eas.fi.gl.IRptAsstactGG;
import com.kingdee.eas.fi.gl.RptAsstactGDFactory;
import com.kingdee.eas.fi.gl.VoucherFacadeFactory;
import com.kingdee.eas.fi.gl.VoucherInfo;
import com.kingdee.eas.fi.gl.common.AsstactTypeEntity;
import com.kingdee.eas.fi.gl.common.GLResUtil;
import com.kingdee.eas.fi.gl.common.RptClientUtil;
import com.kingdee.eas.fi.gl.common.RptConstant;
import com.kingdee.eas.framework.DataBaseInfo;
import com.kingdee.eas.framework.report.ICommRptBase;
import com.kingdee.eas.framework.report.client.CommRptBaseConditionUI;
import com.kingdee.eas.framework.report.client.CommRptBaseUI;
import com.kingdee.eas.framework.report.util.ExcelExporter;
import com.kingdee.eas.framework.report.util.KDTableUtil;
import com.kingdee.eas.framework.report.util.LabelValueBean;
import com.kingdee.eas.framework.report.util.PeriodEntity;
import com.kingdee.eas.framework.report.util.RptParams;
import com.kingdee.eas.framework.report.util.RptRowSet;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;
import com.kingdee.jdbc.rowset.IRowSet;

public class RptAsstactGDUI extends AbstractRptAsstactGDUI {
	private static final long serialVersionUID = 1984485667360451232L;
	private static final Logger logger = CoreUIObject.getLogger(RptAsstactGDUI.class);
	private static final String BIZDATE_COL = "bizDate";
	private static final String CURRENCY_COL = "column8";
	private static final String CURRENCY_LOCAL_COL = "column9";
	private static final String CURRENCY_RPT_COL = "column10";
	private static final String MEASURE_UNIT_COL = "column11";
	private static final String ASST_UNIT_COL = "column12";
	private static final String DEBIT_AMT_COL = "column13";
	private static final String DEBIT_PRICE_COL = "column14";
	private static final String DEBIT_ASSTQTY_COL = "column15";
	private static final String DEBIT_ASSTPRICE_COL = "column16";
	private static final String DEBIT_FOR_COL = "column17";
	private static final String DEBIT_LOCAL_COL = "column18";
	private static final String DEBIT_RPT_COL = "column19";
	private static final String CREDIT_AMT_COL = "column20";
	private static final String CREDIT_PRICE_COL = "column21";
	private static final String CREDIT_ASSTQTY_COL = "column22";
	private static final String CREDIT_ASSTPRICE_COL = "column23";
	private static final String CREDIT_FOR_COL = "column24";
	private static final String CREDIT_LOCAL_COL = "column25";
	private static final String CREDIT_RPT_COL = "column26";
	private static final String END_AMT_COL = "column27";
	private static final String END_PRICE_COL = "column28";
	private static final String END_DC_COL = "column29";
	private static final String END_FOR_COL = "column30";
	private static final String END_LOCAL_COL = "column31";
	private static final String END_RPT_COL = "column32";
	private static final String ACCOUNT_ATTR1_COL = "column33";
	private static final String ACCOUNT_ATTR2_COL = "column34";
	private static final String ACCOUNT_ATTR3_COL = "column35";
	private static final String ACCOUNT_ATTR4_COL = "column36";
	private static final String ACCOUNT_ATTR5_COL = "column37";
	private Map exmap = new HashMap();
	private boolean displayAmount;
	private boolean displayAttribute;
	private HashMap accountmap = new HashMap();

	boolean allowCussent = false;
	private RptAsstactGDParame editParame;
	private KDSeparator kDSeparator6;
	private boolean isMutiCurrencyQueryCussent = false;

	private boolean diplayAsstInfo = false;
	private RptAsstactGDConditionUI rptAsstactGDConditionUI;

	public RptAsstactGDUI() throws Exception {
	}

	protected void checkFIUnit() throws Exception {
		if (getUIContext().get("JoinQuery") == null)
			RptClientUtil.checkFIUnit(false);
	}

	protected String getJoinExportAllLabel() {
		return GLResUtil.getRes("export_asstact_gd") + "EXCEL";
	}

	protected String getJoinExportSelectedLabel() {
		return GLResUtil.getRes("export_part_asstact_gd_account") + "EXCEL";
	}

	public void onLoad() throws Exception {
		setShowFilter(true);
		setShowSorter(true);
		InitClientHelp.setIcon(this.btnJoinQueryList, "imgTbtn_assistantaccount");
		InitClientHelp.setIcon(this.btnJoinQueryVoucher, "imgTbtn_credence");
		InitClientHelp.setIcon(this.btnJoinAcctCussent, "imgTbtn_assistantaccountdetail");

		this.menuItemCalculator.setAccelerator(KeyStroke.getKeyStroke("ctrl shift F12"));
		super.onLoad();
		if (!SysContext.getSysContext().getCurrentFIUnit().isIsBizUnit()) {
			this.actionJoinAcctCussent.setEnabled(false);
		}
		RptParams params = (RptParams) getUIContext().get("com.kingdee.eas.framework.report.client.CommRptBaseUI#UICONTEXT_KEY_INITPARAMS");
		RptParams param = (RptParams) params.getObject("sysParams");
		this.allowCussent = param.getBoolean("GL_028");

		this.menuJoinQueryVoucher.setIcon(EASResource.getIcon("imgTbtn_credence"));
		this.menuItemPrintParame.setEnabled(true);
		this.editParame = RptAsstactGDParame.getInstance();
		this.actionQuery.setEnabled(SysContext.getSysContext().getCurrentFIUnit().isIsBizUnit());
	}

	protected void setDisabledTables() {
	}

	public void initUIMenuBarLayout() {
		super.initUIMenuBarLayout();
		this.kDSeparator6 = new KDSeparator();
		this.kDSeparator6.setName("kDSeparator6");
		this.menuView.add(this.menuItemQuery);
		this.menuView.add(this.menuItemChart);
		this.menuView.add(this.menuItemRefresh);
		this.menuView.add(this.kDSeparator6);
		this.menuView.add(this.menuJoinQueryRptAsstactList);
		this.menuView.add(this.menuJoinQueryVoucher);
	}

	public void loadFields() {
		super.loadFields();
	}

	public void storeFields() {
		super.storeFields();
	}

	protected void tblLeft_tableSelectChanged(KDTSelectEvent e) throws Exception {
		super.tblLeft_tableSelectChanged(e);
		this.actionJoinAcctCussent.setEnabled(false);
		this.actionJoinQueryVoucher.setEnabled(false);
		this.tblMain.reLayoutAndPaint();
	}

	protected void tblLeft_tableClicked(KDTMouseEvent e) throws Exception {
		if ((this.actionJoinQueryRptAsstactList.isEnabled()) && (e.getClickCount() == 2)) {
			if (this.params.getObjectElement("jbxCurrency.value.id") != null)
				joinQueryGG(false);
		}
	}

	protected void tblMain_tableSelectChanged(KDTSelectEvent e) throws Exception {
		boolean enableJoinVoucher = false;
		boolean enableJoinAcctCussent = false;
		if (this.tblMain.getSelectManager().get() != null) {
			int selectIndex = this.tblMain.getSelectManager().get().getTop();
			if (selectIndex < 0) {
				return;
			}

			this.actionJoinQueryRptAsstactList.setEnabled(false);
			this.actionJoinQueryVoucher.setEnabled(true);
			this.actionJoinAcctCussent.setEnabled(true);

			if (this.tblMain.getRow(selectIndex).getCell("column1").getValue() == null) {
				this.actionJoinQueryRptAsstactList.setEnabled(false);
				this.actionJoinQueryVoucher.setEnabled(false);
				this.actionJoinAcctCussent.setEnabled(false);
				return;
			}

			IRow row = this.tblMain.getRow(selectIndex);
			if (row != null) {
				Object voucherId = row.getUserObject();
				if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
					HashMap userObject = (HashMap) row.getUserObject();
					if (userObject.get("FVoucherID") != null) {
						voucherId = userObject.get("FVoucherID").toString();
					}
				}
				if ((voucherId != null) && (String.class.isInstance(voucherId)) && (((String) voucherId).length() > 0)) {
					enableJoinVoucher = true;
					enableJoinAcctCussent = true;
				}
				if (this.allowCussent) {
					String accountNumber = row.getCell(0).getValue().toString();
					AccountViewInfo account = null;
					if (this.accountmap.containsKey(accountNumber)) {
						account = (AccountViewInfo) this.accountmap.get(accountNumber);
					} else {
						int yearEnd = ((Integer) this.params.getObjectElement("jspYearTo.value")).intValue();
						int numberEnd = ((Integer) this.params.getObjectElement("jspPeriodTo.value")).intValue();
						account = GlUtils.findAccountViewInfoByNumber(accountNumber, RptClientUtil.getCompany(yearEnd, numberEnd));
						if (account != null) {
							this.accountmap.put(account.getNumber(), account);
						}
					}
					boolean isleaf = false;
					if ((account != null) && (account.isAC())) {
						RptParams pp = (RptParams) this.params.clone();
						List list = (List) pp.getObject("tableData");

						int itemIndex = 0;
						IRow leftRow = this.tblLeft.getRow(KDTableUtil.getSelectedTop(this.tblLeft));
						int i = 0;
						for (int n = list.size(); i < n; i++) {
							AsstactTypeEntity at = (AsstactTypeEntity) RptParams.cloneObject(list.get(i));
							String table = at.getTableName();
							String attribute = at.getHgAttribute();
							boolean isuseLevel = at.isUseLevel();
							if (attribute.startsWith("General")) {
								isleaf = true;
							} else if (at.isSelected()) {
								Object obj = leftRow.getCell(itemIndex).getValue();
								if ((obj instanceof LabelValueBean)) {
									LabelValueBean labelValue = (LabelValueBean) obj;
									String id = labelValue.getValue();

									Map param = new HashMap();
									param.put("id", id);
									param.put("table", table);

									param.put("isuseLevel", Boolean.valueOf(isuseLevel));
									IGLGeneralFacade facade = GLGeneralFacadeFactory.getRemoteInstance();
									param = facade.dealTask("isleaf", param);
									isleaf = ((Boolean) param.get("isleaf")).booleanValue();
								}
								itemIndex++;
							}
						}
					}
					if ((isleaf) && (account != null) && (account.isAC())) {
						if ((voucherId != null) && (String.class.isInstance(voucherId)) && (((String) voucherId).length() > 0)) {
							enableJoinAcctCussent = true;
						}
					} else {
						enableJoinAcctCussent = false;
					}
				}
				this.actionJoinQueryRptAsstactList.setEnabled(true);
			}
		}
		this.actionJoinQueryVoucher.setEnabled(enableJoinVoucher);
		if (SysContext.getSysContext().getCurrentFIUnit().isIsBizUnit()) {
			this.actionJoinAcctCussent.setEnabled(enableJoinAcctCussent);
		}

		if (getQueryCurrency() == true)
			this.actionJoinAcctCussent.setEnabled(false);
	}

	protected void tblMain_tableClicked(KDTMouseEvent e) throws Exception {
		if (e.getClickCount() == 2) {
			if (this.actionJoinQueryVoucher.isEnabled())
				joinQueryVoucher();
			else if (this.actionJoinQueryRptAsstactList.isEnabled()) {
				if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
					IRow row = this.tblMain.getRow(e.getRowIndex());
					String currencyId = ((Map) row.getUserObject()).get("currencyId").toString();
					CurrencyInfo curCurrency = CurrencyFactory.getRemoteInstance().getCurrencyInfo(new ObjectUuidPK(currencyId));
					this.params.setObjectElement("jbxCurrency.value", curCurrency);
					joinQueryGG(true);
					this.params.setObjectElement("jbxCurrency.value.id", null);
					this.params.setObjectElement("jbxCurrency.value", GLResUtil.getRes("all_currency"));
				} else {
					joinQueryGG(true);
				}
			}
		}
	}

	public void actionJoinQueryRptAsstactList_actionPerformed(ActionEvent e) throws Exception {
		if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
			int rowIndex = this.tblMain.getSelectManager().getActiveRowIndex();
			if (rowIndex < 0) {
				rowIndex = 0;
			}
			IRow row = this.tblMain.getRow(rowIndex);
			String currencyId = ((Map) row.getUserObject()).get("currencyId") == null ? null : ((Map) row.getUserObject()).get("currencyId").toString();
			CurrencyInfo curCurrency = CurrencyFactory.getRemoteInstance().getCurrencyInfo(new ObjectUuidPK(currencyId));
			this.params.setObjectElement("jbxCurrency.value", curCurrency);
			joinQueryGG(true);
			this.params.setObjectElement("jbxCurrency.value.id", null);
			this.params.setObjectElement("jbxCurrency.value", GLResUtil.getRes("all_currency"));
		} else {
			joinQueryGG(true);
		}
	}

	public void actionJoinQueryVoucher_actionPerformed(ActionEvent e) throws Exception {
		joinQueryVoucher();
	}

	public void actionJoinAcctCussent_actionPerformed(ActionEvent e) throws Exception {
		super.actionJoinAcctCussent_actionPerformed(e);
		if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
			IRow row = this.tblMain.getRow(this.tblMain.getSelectManager().getActiveRowIndex());
			checkBeforeJoinQuery(row);
			String currencyId = ((Map) row.getUserObject()).get("currencyId").toString();
			CurrencyInfo curCurrency = CurrencyFactory.getRemoteInstance().getCurrencyInfo(new ObjectUuidPK(currencyId));
			this.params.setObjectElement("jbxCurrency.value", curCurrency);
			this.isMutiCurrencyQueryCussent = true;
			joinQueryAcctCussent();
			this.params.setObjectElement("jbxCurrency.value.id", null);
			this.params.setObjectElement("jbxCurrency.value", GLResUtil.getRes("all_currency"));
		} else {
			joinQueryAcctCussent();
		}
	}

	protected CommRptBaseConditionUI getQueryDialogUserPanel() throws Exception {
		if (this.rptAsstactGDConditionUI == null) {
			this.rptAsstactGDConditionUI = new RptAsstactGDConditionUI();
		}
		if (this.params != null) {
			this.rptAsstactGDConditionUI.setRptParams(this.params);
		}
		return this.rptAsstactGDConditionUI;
	}

	protected ICommRptBase getRemoteInstance() throws BOSException {
		return RptAsstactGDFactory.getRemoteInstance();
	}

	protected int[] getNumberColumns(int offSet) {
		if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
			return new int[] { offSet + 17, offSet + 24, offSet + 30 };
		}

		return new int[] { offSet + 13, offSet + 14, offSet + 16, offSet + 17, offSet + 18, offSet + 19, offSet + 21, offSet + 22, offSet + 23, offSet + 24,
				offSet + 25, offSet + 27, offSet + 28, offSet + 30 };
	}

	protected void query() {
		this.tblMain.checkParsed(true);
		this.actionJoinQueryVoucher.setEnabled(false);
		this.actionJoinQueryRptAsstactList.setEnabled(false);
		this.actionJoinAcctCussent.setEnabled(false);
		try {
			super.query();

			if (this.params.getObjectElement("jcbDisplayAmount.value") != null)
				this.displayAmount = ((Boolean) this.params.getObjectElement("jcbDisplayAmount.value")).booleanValue();
			else {
				this.displayAmount = false;
			}
			if (this.params.getObjectElement("jcbDisplayAttribute.value") != null)
				this.displayAttribute = ((Boolean) this.params.getObjectElement("jcbDisplayAttribute.value")).booleanValue();
			else {
				this.displayAttribute = false;
			}

			isAsstAccountHasMaterial(this.params);
			setQtyPriceColumnStyle();
			setHeadStyle();

			this.tHelper.getDisabledTables().add(this.tblLeft);

			if (!isFirstOnload()) {
				this.tHelper.init();
			}
			this.tblMain.reLayoutAndPaint();
			this.tHelper.restoreDefaultSolution(this.tblMain);
		} catch (Exception e) {
			logger.error("queryPeriodMap", e);
			handUIException(e);
		}
	}

	protected boolean isSetRender() {
		return false;
	}

	protected void setPrecision() {
		if (this.mapScal == null)
			this.mapScal = new HashMap();
		else
			this.mapScal.clear();
		int precision;
		if (this.params.getObjectElement("jbxCurrency.value.precision") == null)
			precision = 2;
		else {
			precision = ((Integer) this.params.getObjectElement("jbxCurrency.value.precision")).intValue();
		}

		this.mapScal.put("precision", new Integer(precision));

		String strQty = this.sysParams.getString("GL_002");
		String strPri = this.sysParams.getString("GL_003");

		int scaleQty = new Integer(strQty).intValue();
		int scalePri = new Integer(strPri).intValue();
		int[] cols = getNumberColumns(0);
		int i = 0;
		for (int n = cols.length; i < n; i++) {
			this.tblMain.getColumn(cols[i]).getStyleAttributes().setNumberFormat(getDecimalFormat(precision));
			this.tblMain.getColumn(cols[i]).getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		}

		this.mapScal.put("scaleQty", new Integer(scaleQty));
		this.mapScal.put("scalePri", new Integer(scalePri));

		this.tblMain.getColumn("column13").getStyleAttributes().setNumberFormat(getDecimalFormat(scaleQty));
		this.tblMain.getColumn("column14").getStyleAttributes().setNumberFormat(getDecimalFormat(scalePri));
		this.tblMain.getColumn("column20").getStyleAttributes().setNumberFormat(getDecimalFormat(scaleQty));
		this.tblMain.getColumn("column21").getStyleAttributes().setNumberFormat(getDecimalFormat(scalePri));
		this.tblMain.getColumn("column27").getStyleAttributes().setNumberFormat(getDecimalFormat(scaleQty));
		this.tblMain.getColumn("column28").getStyleAttributes().setNumberFormat(getDecimalFormat(scalePri));

		this.tblMain.getColumn("column15").getStyleAttributes().setNumberFormat(getDecimalFormat(scaleQty));
		this.tblMain.getColumn("column22").getStyleAttributes().setNumberFormat(getDecimalFormat(scaleQty));
		this.tblMain.getColumn("column16").getStyleAttributes().setNumberFormat(getDecimalFormat(scalePri));
		this.tblMain.getColumn("column23").getStyleAttributes().setNumberFormat(getDecimalFormat(scalePri));

		int baseCurrencyPre = 0;
		int rptCurrencyPre = 0;
		CompanyOrgUnitInfo currCompany = getCurrentFIUnit();
		if (currCompany.getBaseCurrency() != null) {
			baseCurrencyPre = currCompany.getBaseCurrency().getPrecision();
			if (currCompany.getReportCurrency() != null) {
				rptCurrencyPre = currCompany.getReportCurrency().getPrecision();
			}

		}

		this.mapScal.put("baseCurrencyPre", new Integer(baseCurrencyPre));
		this.mapScal.put("rptCurrencyPre", new Integer(rptCurrencyPre));

		this.tblMain.getColumn("column18").getStyleAttributes().setNumberFormat(getDecimalFormat(baseCurrencyPre));
		this.tblMain.getColumn("column25").getStyleAttributes().setNumberFormat(getDecimalFormat(baseCurrencyPre));
		this.tblMain.getColumn("column31").getStyleAttributes().setNumberFormat(getDecimalFormat(baseCurrencyPre));
		this.tblMain.getColumn("column19").getStyleAttributes().setNumberFormat(getDecimalFormat(rptCurrencyPre));
		this.tblMain.getColumn("column26").getStyleAttributes().setNumberFormat(getDecimalFormat(rptCurrencyPre));
		this.tblMain.getColumn("column32").getStyleAttributes().setNumberFormat(getDecimalFormat(rptCurrencyPre));

		this.tblMain.getColumn("column14").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column21").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column30").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column18").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column25").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column31").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column19").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column26").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		this.tblMain.getColumn("column32").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
	}

	protected void setHeadStyle() {
		String currencyId = null;
		if (this.params.getObjectElement("jbxCurrency.value.id") != null) {
			currencyId = this.params.getObjectElement("jbxCurrency.value.id").toString();
		}
		CompanyOrgUnitInfo currCompany = getCurrentFIUnit();
		String baseCurrencyId = currCompany.getBaseCurrency().getId().toString();
		String rptCurrencyId;
		if (currCompany.getReportCurrency() != null)
			rptCurrencyId = currCompany.getReportCurrency().getId().toString();
		else {
			rptCurrencyId = baseCurrencyId;
		}

		if ("11111111-1111-1111-1111-111111111111DEB58FDC".equals(currencyId)) {
			this.tblMain.getColumn("column8").setWidth(-1);

			this.tblMain.getColumn("column9").setWidth(-1);
			this.tblMain.getColumn("column10").setWidth(-1);

			this.tblMain.getColumn("column17").setWidth(-1);
			this.tblMain.getColumn("column18").setWidth(120);
			this.tblMain.getColumn("column19").setWidth(-1);
			this.tblMain.getColumn("column24").setWidth(-1);
			this.tblMain.getColumn("column25").setWidth(120);
			this.tblMain.getColumn("column26").setWidth(-1);
			this.tblMain.getColumn("column30").setWidth(-1);
			this.tblMain.getColumn("column31").setWidth(120);
			this.tblMain.getColumn("column32").setWidth(-1);

			this.tblMain.getColumn("column8").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column9").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column10").getStyleAttributes().setHided(true);

			this.tblMain.getColumn("column17").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column18").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column19").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column24").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column25").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column26").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column30").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column31").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column32").getStyleAttributes().setHided(true);
			this.tblMain.getHead().getRow(1).getCell(31).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
			if (this.displayAmount) {
				this.tblMain.getHead().getRow(1).getCell(18).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
				this.tblMain.getHead().getRow(1).getCell(25).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
			} else {
				this.tblMain.getHead().getRow(1).getCell(18).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "dir_debit"));
				this.tblMain.getHead().getRow(1).getCell(25).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "dir_credit"));
				this.tblMain.getHeadMergeManager().mergeBlock(0, 13, 1, 19);
				this.tblMain.getHeadMergeManager().mergeBlock(0, 20, 1, 26);
			}

		} else if ("22222222-2222-2222-2222-222222222222DEB58FDC".equals(currencyId)) {
			this.tblMain.getColumn("column8").setWidth(-1);
			this.tblMain.getColumn("column9").setWidth(-1);
			this.tblMain.getColumn("column10").setWidth(-1);

			this.tblMain.getColumn("column17").setWidth(-1);
			this.tblMain.getColumn("column18").setWidth(-1);
			this.tblMain.getColumn("column19").setWidth(120);
			this.tblMain.getColumn("column24").setWidth(-1);
			this.tblMain.getColumn("column25").setWidth(-1);
			this.tblMain.getColumn("column26").setWidth(120);
			this.tblMain.getColumn("column30").setWidth(-1);
			this.tblMain.getColumn("column31").setWidth(-1);
			this.tblMain.getColumn("column32").setWidth(120);

			this.tblMain.getColumn("column8").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column9").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column10").getStyleAttributes().setHided(true);

			this.tblMain.getColumn("column17").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column18").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column19").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column24").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column25").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column26").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column30").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column31").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column32").getStyleAttributes().setHided(false);
			this.tblMain.getHead().getRow(1).getCell(32).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
			if (this.displayAmount) {
				this.tblMain.getHead().getRow(1).getCell(19).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
				this.tblMain.getHead().getRow(1).getCell(26).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
			} else {
				this.tblMain.getHead().getRow(1).getCell(19).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "dir_debit"));
				this.tblMain.getHead().getRow(1).getCell(26).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "dir_credit"));
				this.tblMain.getHeadMergeManager().mergeBlock(0, 13, 1, 19);
				this.tblMain.getHeadMergeManager().mergeBlock(0, 20, 1, 26);
			}

		} else if ((currencyId != null) && (currencyId.equals(baseCurrencyId)) && (currencyId.equals(rptCurrencyId))) {
			this.tblMain.getColumn("column8").setWidth(-1);
			this.tblMain.getColumn("column9").setWidth(-1);
			this.tblMain.getColumn("column10").setWidth(-1);

			this.tblMain.getColumn("column17").setWidth(120);
			this.tblMain.getColumn("column18").setWidth(-1);
			this.tblMain.getColumn("column19").setWidth(-1);
			this.tblMain.getColumn("column24").setWidth(120);
			this.tblMain.getColumn("column25").setWidth(-1);
			this.tblMain.getColumn("column26").setWidth(-1);
			this.tblMain.getColumn("column30").setWidth(120);
			this.tblMain.getColumn("column31").setWidth(-1);
			this.tblMain.getColumn("column32").setWidth(-1);

			this.tblMain.getColumn("column8").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column9").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column10").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column17").getStyleAttributes().setHided(false);

			this.tblMain.getColumn("column17").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column18").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column19").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column24").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column25").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column26").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column30").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column31").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column32").getStyleAttributes().setHided(true);
			this.tblMain.getHead().getRow(1).getCell(30).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
			if (this.displayAmount) {
				this.tblMain.getHead().getRow(1).getCell(17).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
				this.tblMain.getHead().getRow(1).getCell(24).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "money_amount"));
			} else {
				this.tblMain.getHead().getRow(1).getCell(17).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "dir_debit"));
				this.tblMain.getHead().getRow(1).getCell(24).setValue(EASResource.getString("com.kingdee.eas.fi.gl.GLRes", "dir_credit"));
				this.tblMain.getHeadMergeManager().mergeBlock(0, 13, 1, 19);
				this.tblMain.getHeadMergeManager().mergeBlock(0, 20, 1, 26);
				for (int i = 0; i < this.tblMain.getRowCount(); i++) {
					KDTMergeManager mm = this.tblMain.getMergeManager();

					mm.mergeBlock(i, 13, i, 19, 4);
					mm.mergeBlock(i, 20, i, 26, 4);
				}
			}

		} else if ((currencyId != null) && (currencyId.equals(baseCurrencyId)) && (!currencyId.equals(rptCurrencyId))) {
			this.tblMain.getColumn("column8").setWidth(-1);
			this.tblMain.getColumn("column9").setWidth(-1);
			this.tblMain.getColumn("column10").setWidth(this.useReportingCurrency ? 80 : -1);

			this.tblMain.getColumn("column17").setWidth(120);
			this.tblMain.getColumn("column18").setWidth(-1);
			this.tblMain.getColumn("column19").setWidth(this.useReportingCurrency ? 120 : -1);
			this.tblMain.getColumn("column24").setWidth(120);
			this.tblMain.getColumn("column25").setWidth(-1);
			this.tblMain.getColumn("column26").setWidth(this.useReportingCurrency ? 120 : -1);
			this.tblMain.getColumn("column30").setWidth(120);
			this.tblMain.getColumn("column31").setWidth(-1);
			this.tblMain.getColumn("column32").setWidth(this.useReportingCurrency ? 120 : -1);

			this.tblMain.getColumn("column8").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column9").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column10").getStyleAttributes().setHided(!this.useReportingCurrency);
			this.tblMain.getColumn("column17").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column18").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column19").getStyleAttributes().setHided(!this.useReportingCurrency);
			this.tblMain.getColumn("column24").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column25").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column26").getStyleAttributes().setHided(!this.useReportingCurrency);
			this.tblMain.getColumn("column30").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column31").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column32").getStyleAttributes().setHided(!this.useReportingCurrency);
		} else if ((currencyId != null) && (!currencyId.equals(baseCurrencyId)) && (currencyId.equals(rptCurrencyId))) {
			this.tblMain.getColumn("column8").setWidth(-1);
			this.tblMain.getColumn("column9").setWidth(80);
			this.tblMain.getColumn("column10").setWidth(-1);

			this.tblMain.getColumn("column17").setWidth(120);
			this.tblMain.getColumn("column18").setWidth(120);
			this.tblMain.getColumn("column19").setWidth(-1);
			this.tblMain.getColumn("column24").setWidth(120);
			this.tblMain.getColumn("column25").setWidth(120);
			this.tblMain.getColumn("column26").setWidth(-1);
			this.tblMain.getColumn("column30").setWidth(120);
			this.tblMain.getColumn("column31").setWidth(120);
			this.tblMain.getColumn("column32").setWidth(-1);

			this.tblMain.getColumn("column8").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column9").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column10").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column17").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column18").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column19").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column24").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column25").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column26").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column30").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column31").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column32").getStyleAttributes().setHided(true);
		} else {
			this.tblMain.getColumn("column8").setWidth(-1);
			this.tblMain.getColumn("column9").setWidth(80);
			this.tblMain.getColumn("column10").setWidth(this.useReportingCurrency ? 80 : -1);

			this.tblMain.getColumn("column17").setWidth(120);
			this.tblMain.getColumn("column18").setWidth(120);
			this.tblMain.getColumn("column19").setWidth(this.useReportingCurrency ? 120 : -1);
			this.tblMain.getColumn("column24").setWidth(120);
			this.tblMain.getColumn("column25").setWidth(120);
			this.tblMain.getColumn("column26").setWidth(this.useReportingCurrency ? 120 : -1);
			this.tblMain.getColumn("column30").setWidth(120);
			this.tblMain.getColumn("column31").setWidth(120);
			this.tblMain.getColumn("column32").setWidth(this.useReportingCurrency ? 120 : -1);

			this.tblMain.getColumn("column8").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column9").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column10").getStyleAttributes().setHided(!this.useReportingCurrency);
			this.tblMain.getColumn("column17").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column18").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column19").getStyleAttributes().setHided(!this.useReportingCurrency);
			this.tblMain.getColumn("column24").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column25").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column26").getStyleAttributes().setHided(!this.useReportingCurrency);
			this.tblMain.getColumn("column30").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column31").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column32").getStyleAttributes().setHided(!this.useReportingCurrency);
		}
	}

	private void setQtyPriceColumnStyle() {
		if (!this.displayAmount) {
			this.tblMain.getColumn("column11").setWidth(-1);
			this.tblMain.getColumn("column13").setWidth(-1);
			this.tblMain.getColumn("column14").setWidth(-1);
			this.tblMain.getColumn("column20").setWidth(-1);
			this.tblMain.getColumn("column21").setWidth(-1);
			this.tblMain.getColumn("column27").setWidth(-1);
			this.tblMain.getColumn("column28").setWidth(-1);
			this.tblMain.getColumn("column11").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column13").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column14").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column20").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column21").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column27").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column28").getStyleAttributes().setHided(true);
		} else {
			this.tblMain.getColumn("column11").setWidth(60);
			this.tblMain.getColumn("column13").setWidth(60);
			this.tblMain.getColumn("column14").setWidth(100);
			this.tblMain.getColumn("column20").setWidth(60);
			this.tblMain.getColumn("column21").setWidth(100);
			this.tblMain.getColumn("column27").setWidth(60);
			this.tblMain.getColumn("column28").setWidth(100);
			this.tblMain.getColumn("column11").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column13").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column14").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column20").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column21").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column27").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column28").getStyleAttributes().setHided(false);
		}

		if (!this.diplayAsstInfo) {
			this.tblMain.getColumn("column12").setWidth(-1);
			this.tblMain.getColumn("column15").setWidth(-1);
			this.tblMain.getColumn("column16").setWidth(-1);
			this.tblMain.getColumn("column23").setWidth(-1);
			this.tblMain.getColumn("column22").setWidth(-1);
			this.tblMain.getColumn("column15").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column16").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column23").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column22").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column12").getStyleAttributes().setHided(true);
		} else {
			this.tblMain.getColumn("column12").setWidth(-1);
			this.tblMain.getColumn("column15").setWidth(-1);
			this.tblMain.getColumn("column16").setWidth(-1);
			this.tblMain.getColumn("column23").setWidth(-1);
			this.tblMain.getColumn("column22").setWidth(-1);
			this.tblMain.getColumn("column15").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column16").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column23").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column22").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column12").getStyleAttributes().setHided(false);
		}
		if (!this.displayAttribute) {
			this.tblMain.getColumn("column33").setWidth(-1);
			this.tblMain.getColumn("column34").setWidth(-1);
			this.tblMain.getColumn("column35").setWidth(-1);
			this.tblMain.getColumn("column36").setWidth(-1);
			this.tblMain.getColumn("column37").setWidth(-1);
			this.tblMain.getColumn("column33").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column34").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column35").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column36").getStyleAttributes().setHided(true);
			this.tblMain.getColumn("column37").getStyleAttributes().setHided(true);
		} else {
			this.tblMain.getColumn("column33").setWidth(120);
			this.tblMain.getColumn("column34").setWidth(120);
			this.tblMain.getColumn("column35").setWidth(120);
			this.tblMain.getColumn("column36").setWidth(120);
			this.tblMain.getColumn("column37").setWidth(120);
			this.tblMain.getColumn("column33").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column34").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column35").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column36").getStyleAttributes().setHided(false);
			this.tblMain.getColumn("column37").getStyleAttributes().setHided(false);

			this.tblMain.getColumn("column33").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
			this.tblMain.getColumn("column34").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
			this.tblMain.getColumn("column35").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
			this.tblMain.getColumn("column36").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
			this.tblMain.getColumn("column37").getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
		}
	}

	public void requestTableData(Object therowIndex) throws Exception {
		int rowIndex = 0;
		try {
			if ((therowIndex != null) && ((therowIndex instanceof Integer))) {
				rowIndex = ((Integer) therowIndex).intValue();
			}
			this.requesting = true;
			setCursorOfWair();
			this.tblMain.removeRows();
			this.tblMain.setRefresh(false);
			IRow row = this.tblLeft.getRow(rowIndex);

			if (row == null) {
				return;
			}

			List itemList = new ArrayList();

			int i = 0;
			for (int n = this.tblLeft.getColumnCount(); i < n; i++) {
				Object cellValue = row.getCell(i).getValue();
				if ((cellValue instanceof LabelValueBean)) {
					itemList.add(cellValue);
				} else {
					boolean isSum = rowIndex == this.tblLeft.getRowCount() - 1;
					Set s = new HashSet();

					boolean isBeginLocate = false;
					for (int r = rowIndex - 1; r >= 0; r--) {
						Object obj = this.tblLeft.getCell(r, i).getValue();
						if ((obj instanceof LabelValueBean)) {
							s.add(obj);
							isBeginLocate = true;
						} else {
							if ((isBeginLocate) && (!isSum))
								break;
						}
					}
					itemList.add(s);
				}
			}

			RptParams pp = (RptParams) this.params.clone();
			pp.remove("tableData");
			pp.setObject("itemList", itemList);
			pp.setObject("actList", getActList());
			pp.setString("tempTable", getTempTable());
			pp.setObject("company", getCurrentFIUnit());
			pp.setString("cuId", getCurrentFIUnit().getCU().getId().toString());
			pp.setString("userId", SysContext.getSysContext().getCurrentUserInfo().getId().toString());
			pp.setObject("sysParams", this.sysParams);
			RptParams rpt = RptAsstactGDFactory.getRemoteInstance().query(pp);
			RptRowSet rs = (RptRowSet) rpt.getObject("rs");
			this.rsParame = rs;

			if (pp.getObjectElement("jcbDisplayAmount.value") != null)
				this.displayAmount = ((Boolean) pp.getObjectElement("jcbDisplayAmount.value")).booleanValue();
			else {
				this.displayAmount = false;
			}

			isAsstAccountHasMaterial(this.params);

			if (pp.getObjectElement("jcbDisplayAttribute.value") != null)
				this.displayAttribute = ((Boolean) pp.getObjectElement("jcbDisplayAttribute.value")).booleanValue();
			else {
				this.displayAttribute = false;
			}
			int[] periodRange = { ((Integer) this.params.getObjectElement("jspYearFrom.value")).intValue(),
					((Integer) this.params.getObjectElement("jspPeriodFrom.value")).intValue(),
					((Integer) this.params.getObjectElement("jspYearTo.value")).intValue(),
					((Integer) this.params.getObjectElement("jspPeriodTo.value")).intValue() };

			getInsertRowsHandler(rs, (RptRowSet) rpt.getObject("balanceRs"), (RptRowSet) rpt.getObject("measureUnitRs"), this.tblMain,
					(PeriodEntity) getUIContextInitParams().getObject("pe"), periodRange).doInsert();
			this.actionJoinQueryRptAsstactList.setEnabled(true);
			if (SysContext.getSysContext().getCurrentFIUnit().isIsBizUnit()) {
				this.actionJoinAcctCussent.setEnabled(true);
			}

			if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
				this.actionJoinQueryRptAsstactList.setEnabled(false);
			}

			this.params.setObject("itemList", pp.getObject("itemList"));

			if (getQueryCurrency() == true)
				this.actionJoinAcctCussent.setEnabled(false);
		} finally {
			this.tblMain.setRefresh(true);
			setCursorOfDefault();
			this.requesting = false;
		}
	}

	public IInsertRowsHandler getInsertRowsHandler(RptRowSet rs, RptRowSet rpt, RptRowSet measureUnitRs, KDTable t, PeriodEntity pe, int[] periodRange) {
		return new InsertHandler(rs, rpt, measureUnitRs, t, pe, periodRange);
	}

	private void joinQueryVoucher() throws Exception {
		try {
			setCursorOfWair();
			if (this.tblMain.getSelectManager().get() != null) {
				int selectIndex = this.tblMain.getSelectManager().get().getTop();
				if (selectIndex < 0)
					return;
				IRow row = this.tblMain.getRow(selectIndex);
				checkBeforeJoinQuery(row);
				if (row != null) {
					Object voucherId = row.getUserObject();
					if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
						HashMap userObject = (HashMap) row.getUserObject();
						if (userObject.get("FVoucherID") != null) {
							voucherId = userObject.get("FVoucherID").toString();
						}
					}
					if ((voucherId != null) && (String.class.isInstance(voucherId)) && (((String) voucherId).length() > 0)) {
						UIContext uiContext = new UIContext(this);
						uiContext.put("ID", ((String) voucherId).trim());
						uiContext.put("company", getCurrentFIUnit());

						uiContext.put("NOTLICHA", "NOTLICHA");

						uiContext.put("VIEWSTATUS", "FINDVIEW");
						IUIWindow uiWindow = UIFactory.createUIFactory(VoucherEditUI.getEditUIMode(this)).create(VoucherInfo.getEditUIName(), uiContext, null,
								OprtState.VIEW);
						uiWindow.show();
					}
				}
			}
		} finally {
			setCursorOfDefault();
		}
	}

	protected CollectEnum getQueryCollectEnum() {
		return CollectEnum.LEAF;
	}

	private void joinQueryGG(boolean limitDetail) throws Exception {
		try {
			setCursorOfWair();

			RptParams pp = (RptParams) this.params.clone();

			pp.setString("tempTable", null);
			pp.setString("balanceTempTable", null);
			pp.setString("com.kingdee.eas.framework.report.client.CommRptBaseUI#PARAMS_KEY_TEMPTABLENAME", null);
			if (this.tblMain.getSelectManager().get() != null) {
				int i = KDTableUtil.getSelectedTop(this.tblMain);
				if (i != -1) {
					String accountNumber = (String) this.tblMain.getCell(i, 0).getValue();
					String accountName = (String) this.tblMain.getCell(i, 1).getValue();
					if ((accountNumber != null) && (accountNumber.trim().length() > 0) && (accountNumber.matches("[\\d\\.]+"))) {
						AccountViewInfo av = new AccountViewInfo();
						av.setNumber(accountNumber.trim());
						av.setName(accountName);
						pp.setObjectElement("jebAccountFrom.value", av);
						pp.setObjectElement("jebAccountTo.value", av);
					}
				}
			}
			StringBuffer dataIds = new StringBuffer();
			if (this.tblLeft.getSelectManager().get() != null) {
				List newList = new ArrayList();
				List list = (List) pp.getObject("tableData");

				int itemIndex = 0;
				IRow leftRow = this.tblLeft.getRow(KDTableUtil.getSelectedTop(this.tblLeft));
				int i = 0;
				for (int n = list.size(); i < n; i++) {
					AsstactTypeEntity at = (AsstactTypeEntity) RptParams.cloneObject(list.get(i));
					at.setCollect(CollectEnum.LEAF);
					newList.add(at);
					if (at.isSelected()) {
						Object obj = leftRow.getCell(itemIndex).getValue();
						if ((obj instanceof LabelValueBean)) {
							LabelValueBean labelValue = (LabelValueBean) obj;
							DataBaseInfo db = new DataBaseDInfo();

							if (((Integer) labelValue.getProperty("FISLeaf")).intValue() == 1) {
								db.setString("number", (String) labelValue.getProperty("FNumber"));
								db.setString("longnumber", (String) labelValue.getProperty("FLongNumber"));
								db.setString("id", labelValue.getValue());
								db.setString("name", labelValue.getLabel());
								at.setFrom(db);
								at.setTo(db);
								dataIds.append(labelValue.getValue());
							} else {
								at.setFrom(null);
								at.setTo(null);
							}

						}

						itemIndex++;
					}
				}
				pp.setObject("tableData", newList);
			}
			pp.setObject("tableDataHasChaged", Boolean.TRUE);
			UIContext uiContext = new UIContext(this);
			CommRptBaseUI ui = createJoinQueryUIWindow(RptAsstactGGUI.class, uiContext, pp);
			if ((ui instanceof RptAsstactGGUI)) {
				((RptAsstactGGUI) ui).onJoinQuery(pp);
				((RptAsstactGGUI) ui).actionRefresh_actionPerformed(null);
			}
			ui.getUIWindow().show();
		} finally {
			setCursorOfDefault();
		}
	}

	public void joinQueryAcctCussent() throws Exception {
		try {
			setCursorOfWair();
			if (this.tblLeft.getSelectManager().get() != null) {
				int selectIndex = this.tblLeft.getSelectManager().get().getTop();
				if (selectIndex < 0) {
					return;
				}

				RptParams pp = (RptParams) this.params.clone();
				pp.setString("tempTable", null);

				List newList = new ArrayList();
				List list = (List) pp.getObject("tableData");

				int itemIndex = 0;
				IRow leftRow = this.tblLeft.getRow(KDTableUtil.getSelectedTop(this.tblLeft));
				int i = 0;
				for (int n = list.size(); i < n; i++) {
					AsstactTypeEntity at = (AsstactTypeEntity) RptParams.cloneObject(list.get(i));
					if (at.isSelected()) {
						newList.add(at);

						Object obj = leftRow.getCell(itemIndex).getValue();
						if ((obj instanceof LabelValueBean)) {
							LabelValueBean labelValue = (LabelValueBean) obj;
							if (((Integer) labelValue.getProperty("FISLeaf")).intValue() != 1) {
								MsgBox.showError(EASResource.getString("com.kingdee.eas.fi.gl.GLAutoGenerateResource", "67_RptAsstactGDUI"));
								return;
							}
							DataBaseInfo db = new DataBaseDInfo();
							db.setString("number", (String) labelValue.getProperty("FNumber"));
							db.setString("longnumber", (String) labelValue.getProperty("FLongNumber"));
							db.setString("id", labelValue.getValue());
							db.setString("name", labelValue.getLabel());
							at.setFrom(db);
							at.setTo(db);
						}

						itemIndex++;
					}
				}
				pp.setObject("tableData", newList);
				if (this.tblMain.getSelectManager().get() != null) {
					i = KDTableUtil.getSelectedTop(this.tblMain);
					if (i != -1) {
						String accountNumber = (String) this.tblMain.getCell(i, 0).getValue();
						if ((accountNumber != null) && (accountNumber.trim().length() > 0) && (accountNumber.matches("[\\d\\.]+"))) {
							AccountViewInfo av = new AccountViewInfo();
							av.setNumber(accountNumber.trim());
							pp.setObjectElement("jebAccountFrom.value", av);
							pp.setObjectElement("jebAccountTo.value", av);
						}
					}
				}
				UIContext uiContext = new UIContext(this);
				uiContext.put("AIXQuery", "AIXQuery");
				uiContext.put("condition", pp);

				IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.NEWTAB).create(AcctCussentListUI.class.getName(), uiContext, this.dataObjects,
						OprtState.VIEW);
				uiWindow.show();
				((AcctCussentListUI) uiWindow.getUIObject()).query(uiContext);
			}
		} finally {
			setCursorOfDefault();
			if (this.isMutiCurrencyQueryCussent) {
				this.params.setObjectElement("jbxCurrency.value.id", null);
				this.params.setObjectElement("jbxCurrency.value", GLResUtil.getRes("all_currency"));
				this.isMutiCurrencyQueryCussent = false;
			}
		}
	}

	protected boolean isChkPrintParame() {
		return this.editParame.isChkPrintParame();
	}

	protected boolean isChkPrintAccountContents() {
		return this.editParame.isChkPrintAccountContents();
	}

	public void actionMenuItemPrintParame_actionPerformed(ActionEvent e) throws Exception {
		UIContext uiContext = new UIContext(this);
		uiContext.put("editParame", this.editParame);
		IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create("com.kingdee.eas.fi.gl.client.RptAsstactGDPrintParameUI", uiContext, null,
				OprtState.EDIT);
		uiWindow.show();
	}

	public void actionPrint_actionPerformed(ActionEvent e) throws Exception {
		if (this.tblMain.getBody().getRows().size() != 0) {
			if (!isChkPrintParame()) {
				print(false);
			} else {
				if ((isChkPrintAccountContents()) && (invokePrintAccount(e, false) == 2)) {
					return;
				}

				invokePrintFunc(e, false);
			}
		} else
			showInfoCom();

		this.actionJoinAcctCussent.setEnabled(false);
	}

	public void actionPrintPreview_actionPerformed(ActionEvent e) throws Exception {
		if (this.tblMain.getBody().getRows().size() != 0) {
			if (!isChkPrintParame()) {
				print(true);
			} else {
				if (isChkPrintAccountContents()) {
					invokePrintAccount(e, true);
				}

				invokePrintFunc(e, true);
			}
		} else {
			showInfoCom();
		}

		this.actionJoinAcctCussent.setEnabled(false);
	}

	private void showInfoCom() {
		KDTable tbl = getTableForPrintSetting();
		tbl.getPrintManager().getNewPrintManager().getPrinter().prompt(Resources.getMsg("prompt.nocontent"));
	}

	protected void invokePrintFunc(ActionEvent evt, boolean noPreview) throws Exception {
		invokePrintFuncRS(evt, noPreview);
	}

	protected int invokePrintAccount(ActionEvent evt, boolean noPreview) throws Exception {
		boolean bBF = this.editParame.isChkBearOver();

		String strPrintAccountContentsPath = null;
		strPrintAccountContentsPath = this.editParame.getStrPrintAccountContentsPath();
		String RESOURCE_PATH = "com.kingdee.eas.fi.gl.client.VoucherEditResource";

		if ((strPrintAccountContentsPath == null) && (StringUtils.isEmpty(strPrintAccountContentsPath))) {
			String msg = EASResource.getString(RESOURCE_PATH, "notTemplet");
			MsgBox.showInfo(msg);
			SysUtil.abort();
		}

		int[] tps = null;
		int j = 0;

		TreeSet ts = new TreeSet();

		tps = KDTableUtil.getSelectedRows(this.tblLeft);

		for (int i = 0; i < tps.length; i++) {
			ts.add(new Integer(tps[i]));
		}

		tps = new int[ts.size()];

		Map var = new HashMap();
		Map varRs = new HashMap();

		for (Iterator iter = ts.iterator(); iter.hasNext(); j++) {
			tps[j] = ((Integer) iter.next()).intValue();

			var.put(new Integer(j), getAsstActPrintTitle(tps[j]));

			requestTableData(new Integer(tps[j]));
			varRs.put(new Integer(j), this.rsParame);
		}

		RptAsstactGDTaodaAccount rsprv = new RptAsstactGDTaodaAccount(var, varRs, bBF);
		KDNoteHelper appHlp = new KDNoteHelper();

		return appHlp.directPrint(strPrintAccountContentsPath, rsprv, noPreview, this);
	}

	protected void invokePrintFuncRS(ActionEvent evt, boolean noPreview) throws Exception {
		boolean bBF = this.editParame.isChkBearOver();

		String strTemplatepathPath = null;
		strTemplatepathPath = this.editParame.getStrTempletpathPath();
		String RESOURCE_PATH = "com.kingdee.eas.fi.gl.client.VoucherEditResource";
		if ((strTemplatepathPath == null) && (StringUtils.isEmpty(strTemplatepathPath))) {
			String msg = EASResource.getString(RESOURCE_PATH, "notTemplet");
			MsgBox.showInfo(msg);
			SysUtil.abort();
		}

		int[] tps = null;
		int j = 0;

		TreeSet ts = new TreeSet();

		tps = KDTableUtil.getSelectedRows(this.tblLeft);

		for (int i = 0; i < tps.length; i++) {
			ts.add(new Integer(tps[i]));
		}

		tps = new int[ts.size()];

		for (Iterator iter = ts.iterator(); iter.hasNext(); j++) {
			tps[j] = ((Integer) iter.next()).intValue();
		}

		ICrossPrintDataProvider[] dps = { new DataProvider(this, tps, bBF) };

		KDNoteHelper appHlp = new KDNoteHelper();
		appHlp.crossPrint(new String[] { strTemplatepathPath }, dps, noPreview, this);
	}

	protected IMetaDataPK getQueryMetaDataPK() {
		return new MetaDataPK("com.kingdee.eas.fi.gl.app", "RptAsstactGDQuery");
	}

	protected void setHeadMergedRegionList(ExcelExporter ee) {
		int deditColIndex = 6;
		int showedColNum = 0;
		for (int i = 0; i < this.tblMain.getColumnCount(); i++) {
			if (this.tblMain.getColumn(i).getStyleAttributes().isHided()) {
				if (i < deditColIndex)
					deditColIndex--;
			} else {
				showedColNum++;
			}
		}
		Object currency = this.params.getObjectElement("jbxCurrency.value");
		boolean isBaseCurrency = false;
		if ((currency instanceof CurrencyInfo)) {
			isBaseCurrency = getCurrentFIUnit().getBaseCurrency().getId().equals(((CurrencyInfo) currency).getId());
		}
		String currencyID = null;
		boolean isGenCurrency = false;
		if (isBaseCurrency) {
			deditColIndex += 2;
		} else if ((currency instanceof CurrencyInfo)) {
			currencyID = ((CurrencyInfo) currency).getId().toString();
			isGenCurrency = ("11111111-1111-1111-1111-111111111111DEB58FDC".equalsIgnoreCase(currencyID))
					|| ("22222222-2222-2222-2222-222222222222DEB58FDC".equalsIgnoreCase(currencyID));
			deditColIndex++;
		} else {
			deditColIndex += 2;
		}
		boolean flag = false;
		int tblLeftColNum = this.tblLeft.getColumnCount() * 2;
		int i = 0;
		for (int col = tblLeftColNum + showedColNum; i < col; i++) {
			if ((i <= tblLeftColNum + deditColIndex) || (flag)) {
				ee.addMergedRegion(1, i, 2, i);
			} else {
				if (isBaseCurrency) {
					ee.addMergedRegion(1, i, 1, i + 1);
					ee.addMergedRegion(2, i, 2, i);
					i++;
					ee.addMergedRegion(2, i, 2, i);
				} else if (isGenCurrency) {
					ee.addMergedRegion(1, i, 1, i);
					ee.addMergedRegion(2, i, 2, i);
					i++;
					ee.addMergedRegion(1, i, 1, i);
					ee.addMergedRegion(2, i, 2, i);
					i++;
					ee.addMergedRegion(1, i, 1, i + 1);
					ee.addMergedRegion(2, i, 2, i);
					i++;
					ee.addMergedRegion(2, i, 2, i);
				} else {
					ee.addMergedRegion(1, i, 1, i + 1);
					i += 2;
					ee.addMergedRegion(1, i, 1, i + 1);
					i += 2;
					ee.addMergedRegion(1, i, 1, i + 2);
					i += 2;
				}
				flag = true;
			}
		}
		ee.setHeadMergedRegionList(true);
	}

	private Object[] autoMatchAmountOrientation(int dc, BigDecimal qty, BigDecimal amount_for, BigDecimal amount_local, BigDecimal amount_rpt,
			boolean isBalanceDirSamAsAccount, String currencyId) {
		Object[] result = new Object[5];
		if (amount_for == null)
			amount_for = GlUtils.zero;
		if (amount_local == null)
			amount_local = GlUtils.zero;
		if (amount_rpt == null)
			amount_rpt = GlUtils.zero;
		if ((amount_for.doubleValue() == 0.0D) && (amount_local.doubleValue() == 0.0D) && (amount_rpt.doubleValue() == 0.0D)) {
			result[0] = qty;
			result[1] = RptConstant.getEquals();
			result[2] = amount_for;
			result[3] = amount_local;
			result[4] = amount_rpt;
		} else if (isBalanceDirSamAsAccount) {
			result[0] = qty;
			result[1] = (dc > 0 ? RptConstant.getDebit() : dc == 0 ? RptConstant.getEquals() : RptConstant.getCredit());

			result[2] = (dc > 0 ? amount_for : amount_for.negate());
			result[3] = (dc > 0 ? amount_local : amount_local.negate());
			result[4] = (dc > 0 ? amount_rpt : amount_rpt.negate());
		} else {
			BigDecimal amount = amount_for;
			if ("22222222-2222-2222-2222-222222222222DEB58FDC".equalsIgnoreCase(currencyId))
				amount = amount_rpt;
			else if ("11111111-1111-1111-1111-111111111111DEB58FDC".equalsIgnoreCase(currencyId)) {
				amount = amount_local;
			}
			if (amount.doubleValue() >= 0.0D) {
				result[0] = qty;
				result[1] = (amount.doubleValue() == 0.0D ? RptConstant.getEquals() : RptConstant.getDebit());
				result[2] = amount_for;
				result[3] = amount_local;
				result[4] = amount_rpt;
			} else {
				result[0] = qty.negate();
				result[1] = RptConstant.getCredit();
				result[2] = amount_for.negate();
				result[3] = amount_local.negate();
				result[4] = amount_rpt.negate();
			}
		}

		return result;
	}

	public Object getTablePreferenceSchemaKey() {
		String disAttr = "";
		String disAmount = "";
		String currency = "";
		if ((this.params.getObjectElement("jcbDisplayAmount.value") != null)
				&& (((Boolean) this.params.getObjectElement("jcbDisplayAmount.value")).booleanValue())) {
			disAmount = "_disAmount";
		}
		if ((this.params.getObjectElement("jcbDisplayAttribute.value") != null)
				&& (((Boolean) this.params.getObjectElement("jcbDisplayAttribute.value")).booleanValue())) {
			disAttr = "_disAttr";
		}
		if (this.params.getObjectElement("jbxCurrency.value.id") != null) {
			currency = this.params.getObjectElement("jbxCurrency.value.id").toString();
		}
		return super.getTablePreferenceSchemaKey().toString() + disAmount + disAttr + currency;
	}

	private void checkBeforeJoinQuery(IRow row) {
		if (row.getCell("column1").getValue() == null) {
			String msg = EASResource.getString("com.kingdee.eas.fi.gl.client.GlResource", "NOTJoinQuery");

			MsgBox.showWarning(this, msg);
			SysUtil.abort();
		}
	}

	protected boolean isExportGD() {
		return true;
	}

	protected IRptAsstactGG getBizInstance() throws BOSException {
		return RptAsstactGDFactory.getRemoteInstance();
	}

	private void isAsstAccountHasMaterial(RptParams params) throws BOSException, EASBizException {
		this.diplayAsstInfo = false;
		String asstAccountID = (String) params.getObjectElement("jebAcct.value.id.toString");
		if (asstAccountID != null) {
			Vector vor = AsstAccountFactory.getRemoteInstance().getAsstActTypeByGroup(new ObjectUuidPK(asstAccountID));
			Iterator itor = vor.iterator();
			while (itor.hasNext()) {
				AsstActTypeInfo asst = (AsstActTypeInfo) itor.next();
				if ((asst.getAsstHGAttribute().equals("material")) && (this.displayAmount) && (getPar())) {
					this.diplayAsstInfo = true;
					break;
				}
			}
		} else {
			List list = (List) params.getObject("tableData");
			if (list != null)
				for (int i = 0; i < list.size(); i++) {
					try {
						AsstactTypeEntity act = (AsstactTypeEntity) RptParams.cloneObject(list.get(i));

						if ((act.isSelected()) && (act.getHgAttribute().equals("material")) && (this.displayAmount) && (getPar())) {
							this.diplayAsstInfo = true;
							break;
						}
					} catch (CloneNotSupportedException e) {
						e.printStackTrace();
					}
				}
		}
	}

	private boolean getPar() {
		boolean re = true;

		String curComId = SysContext.getSysContext().getCurrentFIUnit().getId().toString();
		try {
			Object[] ps = VoucherFacadeFactory.getRemoteInstance().fetchInitData(curComId);
			re = ((Boolean) ps[28]).booleanValue();
		} catch (Exception err) {
			re = false;
			err.printStackTrace();
		}
		return re;
	}

	private boolean getQueryCurrency() {
		if (this.params.getObjectElement("jbxCurrency.value.id") == null) {
			return false;
		}

		CurrencyInfo curCur = (CurrencyInfo) this.params.getObjectElement("jbxCurrency.value");

		return (curCur != null)
				&& ((CurrencyInfo.GENERAL_LOCAL_CURRENCY_ID.toString().equals(curCur.getId().toString())) || (CurrencyInfo.GENERAL_REPORT_CURRENCY_ID
						.toString().equals(curCur.getId().toString())));
	}

	class DataProvider implements ICrossPrintDataProvider {
		private int point = 0;
		private RptAsstactGDUI ui;
		private int[] tps;
		private boolean bBF = false;

		public DataProvider(RptAsstactGDUI ui, int[] tps, boolean bBF) {
			this.ui = ui;
			this.tps = tps;
			this.bBF = bBF;
		}

		public boolean hasNext() {
			return this.point < this.tps.length;
		}

		public IRowSet execute(BOSQueryDataSource ds) {
			int tp = this.tps[(this.point++)];
			try {
				this.ui.requestTableData(new Integer(tp));
			} catch (Exception e) {
				e.printStackTrace();
			}

			Map var = RptAsstactGDUI.this.preparePrintVariantMap();

			var.put("AsstAct", RptAsstactGDUI.this.getAsstActPrintTitle(tp));
			var.put("Asst", RptAsstactGDUI.this.jtAsst2.getText());

			if (this.bBF) {
				var.put("isSumPeriod", new Boolean(RptAsstactGDUI.this.editParame.isSumPeriod()));
				var.put("isSumYear", new Boolean(RptAsstactGDUI.this.editParame.isSumYear()));
			}

			Object isFirstPeriodObj = RptAsstactGDUI.this.params.getObjectElement("rdFirstPeriod.value");
			boolean isFirstPeriod = false;
			if (isFirstPeriodObj != null) {
				isFirstPeriod = ((Boolean) isFirstPeriodObj).booleanValue();
			}
			var.put("isFirstPeriod", new Boolean(isFirstPeriod));

			RptAsstactGDTaoda rsprv = new RptAsstactGDTaoda(var, doRowSet(RptAsstactGDUI.this.rsParame), this.bBF, RptAsstactGDUI.this.mapScal);

			return rsprv.execute(ds);
		}

		protected RptRowSet doRowSet(RptRowSet rs) {
			int oldIndex = 0;
			boolean find = false;
			Object[] objs = null;

			rs.reset();
			while (rs.next()) {
				if (currentRowIsAllNull(rs)) {
					oldIndex = rs.getRow();
					find = false;

					while (rs.previous()) {
						if (!currentRowIsAllNull(rs)) {
							rs.previous();
							find = true;
							objs = rs.toRowArray();
							rs.moveTo(oldIndex);

							for (int i = 0; i < objs.length; i++) {
								if (rs.getColumnName(i).equalsIgnoreCase("fdescription"))
									rs
											.setValue(i, EASResource.getString("com.kingdee.eas.fi.gl.GLAutoGenerateResource",
													"17_RptAsstactMultiColumnRowSetAddBf"));
								else {
									rs.setValue(i, objs[i]);
								}
							}
						}

					}

					if (!find) {
						rs.moveTo(oldIndex);
					}
				}
			}

			String currencyId = null;
			if ((RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value") != null)
					&& ((RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value") instanceof CurrencyInfo))) {
				CurrencyInfo curinfo = (CurrencyInfo) RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value");
				currencyId = curinfo.getId().toString();
			}
			rs.reset();
			while (rs.next()) {
				BigDecimal fBlcQty = new BigDecimal("0");
				if ((RptAsstactGDUI.this.displayAmount) && (rs.getBigDecimal("FENDQTY") != null)) {
					fBlcQty = rs.getBigDecimal("FENDQTY").setScale(6, 4);
				}

				int fdc = rs.getObject("FDC") == null ? 0 : rs.getInt("FDC");
				int rowType = rs.getInt("frowtype");
				if (10 == rowType) {
					fdc = 1;
					rs.setValue("FDC", null);
				}

				Object[] objRe = RptAsstactGDUI.this.autoMatchAmountOrientation(fdc, fBlcQty, rs.getBigDecimal("FBalance_for"), rs
						.getBigDecimal("FBalance_local"), rs.getBigDecimal("FBalance_rpt"), RptAsstactGDUI.this.sysParams.getBoolean("GL_005"), currencyId);

				for (int i = 0; i < rs.toRowArray().length; i++) {
					if (rs.getColumnName(i).equalsIgnoreCase("FENDQTY")) {
						if (10 != rowType)
							rs.setValue(i, objRe[0]);
					} else if (rs.getColumnName(i).equalsIgnoreCase("fdc")) {
						if (10 == rowType)
							rs.setValue(i, null);
						else
							rs.setValue(i, objRe[1]);
					} else if (rs.getColumnName(i).equalsIgnoreCase("fbalance_for")) {
						if (10 != rowType)
							rs.setValue(i, objRe[2]);
					} else if (rs.getColumnName(i).equalsIgnoreCase("fbalance_local")) {
						if (10 != rowType)
							rs.setValue(i, objRe[3]);
					} else if (rs.getColumnName(i).equalsIgnoreCase("fbalance_rpt")) {
						if (10 != rowType)
							rs.setValue(i, objRe[4]);
					} else if (rs.getColumnName(i).equalsIgnoreCase("fbalanceprice")) {
						BigDecimal balanceprice = (rs.getBigDecimal("fendqty") == null) || (GlUtils.zero.compareTo(rs.getBigDecimal("fendqty")) == 0) ? GlUtils.zero
								: rs.getBigDecimal("fbalance_local").divide(rs.getBigDecimal("fendqty"), 11, 4);
						if (balanceprice.compareTo(GlUtils.zero) < 0) {
							balanceprice = balanceprice.negate();
						}
						rs.setValue(i, balanceprice);
					} else if (rs.getColumnName(i).equalsIgnoreCase("FDEBITPRICE")) {
						if (rs.getString("FVOUCHERID") == null) {
							BigDecimal debitprice = (rs.getBigDecimal("fdebitqty") == null) || (GlUtils.zero.compareTo(rs.getBigDecimal("fdebitqty")) == 0) ? GlUtils.zero
									: rs.getBigDecimal("fdebit_local").divide(rs.getBigDecimal("fdebitqty"), 11, 4);
							if (debitprice.compareTo(GlUtils.zero) < 0) {
								debitprice = debitprice.negate();
							}
							rs.setValue(i, debitprice);
						}
					} else {
						if ((!rs.getColumnName(i).equalsIgnoreCase("FCREDITPRICE")) || (rs.getString("FVOUCHERID") != null))
							continue;
						BigDecimal creditprice = (rs.getBigDecimal("fcreditqty") == null) || (GlUtils.zero.compareTo(rs.getBigDecimal("fcreditqty")) == 0) ? GlUtils.zero
								: rs.getBigDecimal("fcredit_local").divide(rs.getBigDecimal("fcreditqty"), 11, 4);
						if (creditprice.compareTo(GlUtils.zero) < 0) {
							creditprice = creditprice.negate();
						}
						rs.setValue(i, creditprice);
					}
				}

			}

			return rs;
		}

		private boolean currentRowIsAllNull(RptRowSet rs) {
			Object[] objs = rs.toRowArray();
			int i = 0;
			for (int n = objs.length; i < n; i++) {
				if (objs[i] != null) {
					return false;
				}
			}
			return true;
		}
	}

	class InsertHandler implements IInsertRowsHandler {
		private RptRowSet rs;
		private KDTable tbl;
		private boolean sameAsAccount = RptAsstactGDUI.this.sysParams.getBoolean("GL_005");
		private boolean sumByMeasureUnit;
		String currencyId;
		private final int ROW_TYPE_INIT = 0;

		private final int ROW_TYPE_DATA = 1;

		private final int ROW_TYPE_PERIOD = 2;

		private final int ROW_TYPE_YEAR = 3;

		private final int ROW_TYPE_SUBTOTAL = 4;

		private int localCurPrecision = 2;

		private int rptCurPrecision = 2;
		protected CurrencyInfo localCurrency;
		protected CurrencyInfo reportingCurrency;
		private boolean isBaseCurrency = false;
		private CurrencyInfo curinfo;
		private int currPeriod;
		private int currYear;

		InsertHandler(RptRowSet rs, RptRowSet balanceRs, RptRowSet measureUnitRs, KDTable tbl, PeriodEntity pe, int[] periodRange) {
			this.rs = rs;
			this.tbl = tbl;
			CompanyOrgUnitInfo currCompany = RptAsstactGDUI.this.getCurrentFIUnit();
			this.localCurrency = currCompany.getBaseCurrency();
			this.reportingCurrency = currCompany.getReportCurrency();

			if ((RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value") != null)
					&& ((RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value") instanceof CurrencyInfo))) {
				this.curinfo = ((CurrencyInfo) RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value"));
				this.currencyId = this.curinfo.getId().toString();

				this.isBaseCurrency = this.currencyId.equals(this.localCurrency.getId().toString());
			} else {
				this.isBaseCurrency = false;
			}

			if (RptAsstactGDUI.this.params.getObjectElement("jcbSumByMeasureUnit.value") != null)
				this.sumByMeasureUnit = ((Boolean) RptAsstactGDUI.this.params.getObjectElement("jcbSumByMeasureUnit.value")).booleanValue();
			else {
				this.sumByMeasureUnit = false;
			}
			this.currPeriod = (pe.getCurrentYear() * 100 + pe.getCurrentPeriod());
			this.currYear = pe.getCurrentYear();
		}

		public void doInsert() {
			this.rs.reset();
			while (this.rs.next())
				_doInsert();
		}

		private void _doInsert() {
			boolean isPriceFlowVoucher = true;
			IRow row = this.tbl.addRow();

			int rowType = this.rs.getInt("FRowType");

			if (rowType == 10) {
				row.getCell("column7").setValue(this.rs.getObject("FDescription"));

				if (this.curinfo != null) {
					row.getCell("column17").setValue(this.rs.getObject("fdebit_for"));

					row.getCell("column18").setValue(this.rs.getObject("fdebit_local"));

					row.getCell("column19").setValue(this.rs.getObject("fdebit_rpt"));

					row.getCell("column24").setValue(this.rs.getObject("fcredit_for"));

					row.getCell("column25").setValue(this.rs.getObject("fcredit_local"));

					row.getCell("column26").setValue(this.rs.getObject("fcredit_rpt"));

					row.getCell("column30").setValue(this.rs.getObject("fbalance_for"));

					row.getCell("column31").setValue(this.rs.getObject("fbalance_local"));

					row.getCell("column32").setValue(this.rs.getObject("fbalance_rpt"));
				} else {
					row.getCell("column18").setValue(this.rs.getObject("fdebit_local"));

					row.getCell("column25").setValue(this.rs.getObject("fcredit_local"));

					row.getCell("column31").setValue(this.rs.getObject("fbalance_local"));
				}

				row.getStyleAttributes().setBackground(new Color(16119270));

				return;
			}

			int fdc = this.rs.getInt("FDC");
			int precision = 2;
			if (this.curinfo != null)
				precision = this.curinfo.getPrecision();
			else {
				precision = this.rs.getInt("FPrecision");
			}

			switch (rowType) {
			case 0:
				if (this.rs.getInt("FPeriodYear") * 100 + this.rs.getInt("FPeriodNumber") <= this.currPeriod)
					break;
				int currRow = this.rs.getRow();
				String accountNumber = this.rs.getString("FAccountNumber");
				String currencyNumber = null;
				if (this.currencyId == null) {
					currencyNumber = this.rs.getString("FCurrencyNumber");
				}
				boolean foundFlag = false;
				while (true) {
					if (!this.rs.previous())
						break;
					if (accountNumber.equals(this.rs.getString("FAccountNumber"))) {
						if (this.currencyId != null)
							break;
						if (currencyNumber.equals(this.rs.getString("FCurrencyNumber"))) {
							foundFlag = true;
							break;
						}
					}
				}
				foundFlag = true;

				if (foundFlag) {
					BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
					BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
					BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
					BigDecimal qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FEndQty") : GlUtils.zero;
					this.rs.moveTo(currRow);
					this.rs.setValue("FBalance_for", balance_for);
					this.rs.setValue("FBalance_local", balance_local);
					this.rs.setValue("FBalance_rpt", balance_rpt);
					if (RptAsstactGDUI.this.displayAmount)
						this.rs.setValue("FEndQty", qty);
				} else {
					this.rs.moveTo(currRow);
				}
				break;
			case 1:
				if ((this.curinfo != null) && (!"11111111-1111-1111-1111-111111111111DEB58FDC".equalsIgnoreCase(this.currencyId))
						&& (!"22222222-2222-2222-2222-222222222222DEB58FDC".equalsIgnoreCase(this.currencyId))) {
					this.localCurPrecision = GlUtils.getEx(null, this.curinfo, this.localCurrency, RptAsstactGDUI.this.exmap,
							RptAsstactGDUI.this.useReportingCurrency);
					this.rptCurPrecision = GlUtils.getEx(null, this.curinfo, this.reportingCurrency, RptAsstactGDUI.this.exmap,
							RptAsstactGDUI.this.useReportingCurrency);
				} else {
					String strCurrencyId = this.rs.getString("FCurrencyID");
					if ((strCurrencyId != null) && (strCurrencyId.trim().length() != 0)) {
						CurrencyInfo curInfo = new CurrencyInfo();
						curInfo.setId(BOSUuid.read(strCurrencyId));
						curInfo.setPrecision(this.rs.getInt("FPrecision"));
						this.localCurPrecision = GlUtils.getEx(null, curInfo, this.localCurrency, RptAsstactGDUI.this.exmap,
								RptAsstactGDUI.this.useReportingCurrency);
						if (3 == RptAsstactGDUI.this.getCurrentFIUnit().getReportConvertMode().getValue())
							this.rptCurPrecision = GlUtils.getEx(null, this.localCurrency, this.reportingCurrency, RptAsstactGDUI.this.exmap,
									RptAsstactGDUI.this.useReportingCurrency);
						else {
							this.rptCurPrecision = GlUtils.getEx(null, curInfo, this.reportingCurrency, RptAsstactGDUI.this.exmap,
									RptAsstactGDUI.this.useReportingCurrency);
						}
					}
				}
				if ((!this.sumByMeasureUnit) || ((this.sumByMeasureUnit) && (this.rs.getInt("isSumMU") == 0))) {
					BigDecimal debit_for = this.rs.getObject("FDebit_for") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_for");
					BigDecimal debit_local = this.rs.getObject("FDebit_local") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_local");
					BigDecimal debit_rpt = this.rs.getObject("FDebit_rpt") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_rpt");
					BigDecimal credit_for = this.rs.getObject("FCredit_for") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_for");
					BigDecimal credit_local = this.rs.getObject("FCredit_local") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_local");
					BigDecimal credit_rpt = this.rs.getObject("FCredit_rpt") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_rpt");
					BigDecimal debit_qty = GlUtils.zero;
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FDebitQty") != null)) {
						debit_qty = this.rs.getBigDecimal("FDebitQty");
						if ((RptAsstactGDUI.this.params.getObjectElement("jebMeasureUnit.value") == null) && (this.rs.getBigDecimal("FCoefficient") != null)) {
							debit_qty = this.rs.getBigDecimal("FDebitQty").multiply(this.rs.getBigDecimal("FCoefficient"));
						}
					}
					BigDecimal credit_qty = GlUtils.zero;
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FCreditQty") != null)) {
						credit_qty = this.rs.getBigDecimal("FCreditQty");
						if ((RptAsstactGDUI.this.params.getObjectElement("jebMeasureUnit.value") == null) && (this.rs.getBigDecimal("FCoefficient") != null)) {
							credit_qty = this.rs.getBigDecimal("FCreditQty").multiply(this.rs.getBigDecimal("FCoefficient"));
						}
					}
					this.rs.previous();
					BigDecimal preBlance_for = this.rs.getBigDecimal("FBalance_for");
					BigDecimal preBalance_local = this.rs.getBigDecimal("FBalance_local");
					BigDecimal preBalance_rpt = this.rs.getBigDecimal("FBalance_rpt");

					BigDecimal preEnd_qty = GlUtils.zero;
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FEndQty") != null)) {
						preEnd_qty = this.rs.getBigDecimal("FEndQty");
					}
					BigDecimal balance_for = preBlance_for.add(debit_for).subtract(credit_for);
					BigDecimal balance_local = preBalance_local.add(debit_local).subtract(credit_local);
					BigDecimal balance_rpt = preBalance_rpt.add(debit_rpt).subtract(credit_rpt);
					BigDecimal end_qty = preEnd_qty.add(debit_qty).subtract(credit_qty);
					this.rs.next();
					this.rs.setValue("FBalance_for", balance_for);
					this.rs.setValue("FBalance_local", balance_local);
					this.rs.setValue("FBalance_rpt", balance_rpt);
					if (RptAsstactGDUI.this.displayAmount)
						this.rs.setValue("FEndQty", end_qty);
				} else {
					if ((!this.sumByMeasureUnit) || (this.rs.getInt("isSumMU") != 1))
						break;
					this.rs.previous();
					BigDecimal end_qty = this.rs.getBigDecimal("FEndQty");
					BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
					BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
					BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
					this.rs.next();
					this.rs.setValue("FEndQty", end_qty);
					this.rs.setValue("FBalance_for", balance_for);
					this.rs.setValue("FBalance_local", balance_local);
					this.rs.setValue("FBalance_rpt", balance_rpt);
					row.getStyleAttributes().setBackground(RptConstant.ROW_COLOR_DAY_SUM);
				}
				break;
			case 4:
				row.getStyleAttributes().setBackground(RptConstant.ROW_COLOR_DAY_SUM);
				break;
			case 2:
				if (this.rs.getInt("FPeriodYear") * 100 + this.rs.getInt("FPeriodNumber") > this.currPeriod) {
					currRow = this.rs.getRow();
					accountNumber = this.rs.getString("FAccountNumber");
					if (this.currencyId == null) {
						currencyNumber = this.rs.getString("FCurrencyNumber");
					} else {
						currencyNumber = "";
					}
					foundFlag = false;
					while (true) {
						if (!this.rs.previous())
							break;
						if (accountNumber.equals(this.rs.getString("FAccountNumber"))) {
							if (this.currencyId != null)
								break;
							if (this.rs.getString("FCurrencyNumber").equals(currencyNumber)) {
								foundFlag = true;
								break;
							}
						}
					}
					foundFlag = true;

					if (foundFlag) {
						BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
						BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
						BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
						BigDecimal qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FEndQty") : GlUtils.zero;
						this.rs.moveTo(currRow);
						this.rs.setValue("FBalance_for", balance_for);
						this.rs.setValue("FBalance_local", balance_local);
						this.rs.setValue("FBalance_rpt", balance_rpt);
						if (RptAsstactGDUI.this.displayAmount)
							this.rs.setValue("FEndQty", qty);
					} else {
						this.rs.moveTo(currRow);
					}
				} else {
					this.rs.previous();
					BigDecimal end_qty = GlUtils.zero;
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FEndQty") != null)) {
						end_qty = this.rs.getBigDecimal("FEndQty");
					}
					BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
					BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
					BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
					this.rs.next();
					this.rs.setValue("FBalance_for", balance_for);
					this.rs.setValue("FBalance_local", balance_local);
					this.rs.setValue("FBalance_rpt", balance_rpt);
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FEndQty") != null)) {
						this.rs.setValue("FEndQty", end_qty);
					}
				}
				row.getStyleAttributes().setBackground(RptConstant.ROW_COLOR_PERIOD_TOTAL);
				break;
			case 3:
				label560: if ((this.rs.getInt("FPeriodYear") * 100 + this.rs.getInt("FPeriodNumber") > this.currPeriod)
						&& (this.rs.getInt("FPeriodYear") <= this.currYear)) {
					this.rs.previous();

					BigDecimal pDebit_for = this.rs.getBigDecimal("FDebit_for") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_for");
					BigDecimal pDebit_local = this.rs.getBigDecimal("FDebit_local") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_local");
					BigDecimal pDebit_rpt = this.rs.getBigDecimal("FDebit_rpt") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_rpt");
					BigDecimal pCredit_for = this.rs.getBigDecimal("FCredit_for") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_for");
					BigDecimal pCredit_local = this.rs.getBigDecimal("FCredit_local") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_local");
					BigDecimal pCredit_rpt = this.rs.getBigDecimal("FCredit_rpt") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_rpt");
					BigDecimal pDebit_qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FDebitQty")
							: this.rs.getBigDecimal("FDebitQty") == null ? GlUtils.zero : GlUtils.zero;
					BigDecimal pCredit_qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FCreditQty")
							: this.rs.getBigDecimal("FCreditQty") == null ? GlUtils.zero : GlUtils.zero;
					BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
					BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
					BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
					BigDecimal qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FEndQty") : GlUtils.zero;
					this.rs.next();
					this.rs.setValue("FBalance_for", balance_for);
					this.rs.setValue("FBalance_local", balance_local);
					this.rs.setValue("FBalance_rpt", balance_rpt);
					if (RptAsstactGDUI.this.displayAmount) {
						this.rs.setValue("FEndQty", qty);
					}

					currRow = this.rs.getRow();
					accountNumber = this.rs.getString("FAccountNumber");
					currencyNumber = null;
					if (this.currencyId == null) {
						currencyNumber = this.rs.getString("FCurrencyNumber");
					}
					foundFlag = false;
					while (this.rs.previous()) {
						if (accountNumber.equals(this.rs.getString("FAccountNumber"))) {
							if (this.currencyId == null) {
								if ((!currencyNumber.equals(this.rs.getString("FCurrencyNumber"))) || (this.rs.getInt("FRowType") != 3))
									continue;
								foundFlag = true;
							} else if (this.rs.getInt("FRowType") == 3) {
								foundFlag = true;
							}
						}

					}

					if (foundFlag) {
						BigDecimal debit_for = this.rs.getBigDecimal("FDebit_for");
						BigDecimal debit_local = this.rs.getBigDecimal("FDebit_local");
						BigDecimal debit_rpt = this.rs.getBigDecimal("FDebit_rpt");
						BigDecimal credit_for = this.rs.getBigDecimal("FCredit_for");
						BigDecimal credit_local = this.rs.getBigDecimal("FCredit_local");
						BigDecimal credit_rpt = this.rs.getBigDecimal("FCredit_rpt");
						BigDecimal debit_qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FDebitQty") : GlUtils.zero;
						BigDecimal credit_qty = RptAsstactGDUI.this.displayAmount ? this.rs.getBigDecimal("FCreditQty") : GlUtils.zero;
						this.rs.moveTo(currRow);
						this.rs.setValue("FDebit_for", debit_for.add(pDebit_for));
						this.rs.setValue("FDebit_local", debit_local.add(pDebit_local));
						this.rs.setValue("FDebit_rpt", debit_rpt.add(pDebit_rpt));
						this.rs.setValue("FCredit_for", credit_for.add(pCredit_for));
						this.rs.setValue("FCredit_local", credit_local.add(pCredit_local));
						this.rs.setValue("FCredit_rpt", credit_rpt.add(pCredit_rpt));
						if (RptAsstactGDUI.this.displayAmount) {
							this.rs.setValue("FDebitQty", debit_qty.add(pDebit_qty));
							this.rs.setValue("FCreditQty", credit_qty.add(pCredit_qty));
						}
					} else {
						this.rs.moveTo(currRow);
					}
				} else {
					this.rs.previous();
					BigDecimal end_qty = GlUtils.zero;
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FEndQty") != null)) {
						end_qty = this.rs.getBigDecimal("FEndQty");
					}
					BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
					BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
					BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
					this.rs.next();
					this.rs.setValue("FBalance_for", balance_for);
					this.rs.setValue("FBalance_local", balance_local);
					this.rs.setValue("FBalance_rpt", balance_rpt);
					if ((RptAsstactGDUI.this.displayAmount) && (this.rs.getBigDecimal("FEndQty") != null)) {
						this.rs.setValue("FEndQty", end_qty);
					}
				}
				label1829: row.getStyleAttributes().setBackground(RptConstant.ROW_COLOR_YEAR_TOTAL);
			}

			row.getCell("column1").setValue(this.rs.getString("FAccountNumber"));
			row.getCell("column2").setValue(this.rs.getString("FAccountName"));

			if (this.rs.getObject("fbookeddate") != null) {
				row.getCell("column3").setValue(KDTableUtil.parseDatePart(this.rs.getObject("fbookeddate").toString()));
			}

			row.getCell("column4").setValue(this.rs.getInt("FPeriodYear") + "." + this.rs.getInt("FPeriodNumber"));

			row.getCell("column5").setValue(this.rs.getString("FVoucherType"));
			row.getCell("column6").setValue(this.rs.getString("FVoucherNo"));
			if (this.rs.getObject("FBizDate") != null) {
				row.getCell("bizDate").setValue(KDTableUtil.parseDatePart(this.rs.getObject("FBizDate").toString()));
			}
			row.getCell("column7").setValue(this.rs.getObject("FDescription", ""));
			if (this.curinfo == null) {
				row.getCell("column8").setValue(this.rs.getObject("FCurrencyName"));
			}
			row.getCell("column9").setValue(this.rs.getObject("FLocalExchangeRate", ""));
			row.getCell("column10").setValue(this.rs.getObject("FReportingExchangeRate", ""));
			row.getCell("column9").getStyleAttributes().setNumberFormat(RptAsstactGDUI.this.getDecimalFormat(this.localCurPrecision));
			row.getCell("column10").getStyleAttributes().setNumberFormat(RptAsstactGDUI.this.getDecimalFormat(this.rptCurPrecision));
			BigDecimal FDebit_for = this.rs.getObject("FDebit_for") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_for");
			BigDecimal FDebit_local = this.rs.getObject("FDebit_local") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_local");
			BigDecimal FDebit_rpt = this.rs.getObject("FDebit_rpt") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebit_rpt");
			row.getCell("column17").setValue(FDebit_for);
			row.getCell("column18").setValue(FDebit_local);
			row.getCell("column19").setValue(FDebit_rpt);
			BigDecimal FCredit_for = this.rs.getObject("FCredit_for") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_for");
			BigDecimal FCredit_local = this.rs.getObject("FCredit_local") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_local");
			BigDecimal FCredit_rpt = this.rs.getObject("FCredit_rpt") == null ? GlUtils.zero : this.rs.getBigDecimal("FCredit_rpt");
			row.getCell("column24").setValue(FCredit_for);
			row.getCell("column25").setValue(FCredit_local);
			row.getCell("column26").setValue(FCredit_rpt);

			BigDecimal balance_for = this.rs.getBigDecimal("FBalance_for");
			BigDecimal balance_local = this.rs.getBigDecimal("FBalance_local");
			BigDecimal balance_rpt = this.rs.getBigDecimal("FBalance_rpt");
			BigDecimal fBlcQty = GlUtils.zero;
			if (RptAsstactGDUI.this.displayAmount) {
				row.getCell("column11").setValue(this.rs.getString("FMeasureUnitName"));
				BigDecimal FDebitQty = this.rs.getBigDecimal("FDebitQty") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebitQty");
				row.getCell("column13").setValue(FDebitQty);

				if ((isPriceFlowVoucher) && (1 == rowType)) {
					row.getCell("column14").setValue(this.rs.getBigDecimal("FDebitPrice"));
				} else if (FDebitQty.doubleValue() != 0.0D) {
					BigDecimal FDebitPrice = FDebit_for.divide(FDebitQty, 10, 4).abs();
					if ((rowType == 1)
							&& (("22222222-2222-2222-2222-222222222222DEB58FDC".equalsIgnoreCase(this.currencyId)) || ("11111111-1111-1111-1111-111111111111DEB58FDC"
									.equalsIgnoreCase(this.currencyId)))) {
						FDebitPrice = GlUtils.zero;
					}
					row.getCell("column14").setValue(FDebitPrice);
				}
				BigDecimal FCreditQty = this.rs.getBigDecimal("FCreditQty") == null ? GlUtils.zero : this.rs.getBigDecimal("FCreditQty");
				row.getCell("column20").setValue(FCreditQty);
				if ((isPriceFlowVoucher) && (1 == rowType)) {
					row.getCell("column21").setValue(this.rs.getBigDecimal("FCreditPrice"));
				} else if (FCreditQty.doubleValue() != 0.0D) {
					BigDecimal FCreditPrice = FCredit_for.divide(FCreditQty, 10, 4).abs();
					if ((rowType == 1)
							&& (("22222222-2222-2222-2222-222222222222DEB58FDC".equalsIgnoreCase(this.currencyId)) || ("11111111-1111-1111-1111-111111111111DEB58FDC"
									.equalsIgnoreCase(this.currencyId)))) {
						FCreditPrice = GlUtils.zero;
					}
					row.getCell("column21").setValue(FCreditPrice);
				}
				if (RptAsstactGDUI.this.diplayAsstInfo) {
					BigDecimal FDebitAssistQty = this.rs.getBigDecimal("FDebitAssistQty") == null ? GlUtils.zero : this.rs.getBigDecimal("FDebitAssistQty");
					BigDecimal FCreditAssistQty = this.rs.getBigDecimal("FCreditAssistQty") == null ? GlUtils.zero : this.rs.getBigDecimal("FCreditAssistQty");
					BigDecimal FCreditAssistPrice = this.rs.getBigDecimal("FCreditAssistPrice") == null ? GlUtils.zero : this.rs
							.getBigDecimal("FCreditAssistPrice");
					BigDecimal FDebitAssistPrice = this.rs.getBigDecimal("FDebitAssistPrice") == null ? GlUtils.zero : this.rs
							.getBigDecimal("FDebitAssistPrice");
					row.getCell("column12").setValue(this.rs.getString("FAssistUnitName"));
					row.getCell("column15").setValue(FDebitAssistQty);
					row.getCell("column22").setValue(FCreditAssistQty);
					row.getCell("column23").setValue(FCreditAssistPrice);
					row.getCell("column16").setValue(FDebitAssistPrice);
				}
				if (this.rs.getBigDecimal("FEndQty") != null) {
					fBlcQty = this.rs.getBigDecimal("FEndQty");
				}
			}
			Object[] re = RptAsstactGDUI.this.autoMatchAmountOrientation(fdc, fBlcQty, balance_for, balance_local, balance_rpt, this.sameAsAccount,
					this.currencyId);
			if (RptAsstactGDUI.this.displayAmount) {
				if ((re[0] instanceof BigDecimal)) {
					BigDecimal amount = (BigDecimal) re[0];
					row.getCell("column27").setValue(amount.doubleValue() == 0.0D ? null : amount);
				} else {
					row.getCell("column27").setValue(re[0]);
				}
			}
			row.getCell("column29").setValue(re[1]);
			row.getCell("column30").setValue(re[2]);
			row.getCell("column31").setValue(re[3]);
			row.getCell("column32").setValue(re[4]);
			if (RptAsstactGDUI.this.displayAmount) {
				BigDecimal endBalance = (BigDecimal) re[2];
				if ("22222222-2222-2222-2222-222222222222DEB58FDC".equalsIgnoreCase(this.currencyId))
					endBalance = (BigDecimal) re[4];
				if ("11111111-1111-1111-1111-111111111111DEB58FDC".equalsIgnoreCase(this.currencyId)) {
					endBalance = (BigDecimal) re[3];
				}
				if (((BigDecimal) re[0]).doubleValue() != 0.0D) {
					BigDecimal endQty = endBalance.divide((BigDecimal) re[0], 10, 4).abs();
					row.getCell("column28").setValue(endQty);
				}
			}
			if (RptAsstactGDUI.this.displayAttribute) {
				row.getCell("column33").setValue(this.rs.getString("FBizNumber"));
				row.getCell("column34").setValue(this.rs.getString("FInvoiceNumber"));
				row.getCell("column35").setValue(this.rs.getString("FSettlementCode"));
				row.getCell("column36").setValue(this.rs.getString("settleName"));
				row.getCell("column37").setValue(this.rs.getString("FTicketNumber"));
			}

			if (RptAsstactGDUI.this.params.getObjectElement("jbxCurrency.value.id") == null) {
				String[] cellCount = { "column17", "column24", "column30" };
				for (int i = 0; i < cellCount.length; i++) {
					row.getCell(cellCount[i]).getStyleAttributes().setNumberFormat(RptAsstactGDUI.this.getDecimalFormat(precision));
					row.getCell(cellCount[i]).getStyleAttributes().setHorizontalAlign(Styles.HorizontalAlignment.RIGHT);
				}
				HashMap userObject = new HashMap();
				userObject.put("FVoucherID", this.rs.getString("FVoucherID"));
				userObject.put("precision", new Integer(precision));
				userObject.put("currencyId", this.rs.getString("FCurrencyId"));
				row.setUserObject(userObject);
			} else {
				row.setUserObject(this.rs.getString("FVoucherID"));
			}
		}

		class AccountInfo {
			Integer dc;
			String name;

			AccountInfo(String name, int dc) {
				this.name = name;
				this.dc = new Integer(dc);
			}
		}
	}
}